import { defineStore } from "pinia"
import axios from 'axios';
import { nanoid } from 'nanoid/non-secure';
import { reactive } from "vue"
export const useTalkStore = defineStore("talk", () => {
  //数据
  const talkList = JSON.parse(localStorage.getItem("talkStore") as string) || []
  // 方法
  async function getAPic() {
    let res = await axios.get("https://v2.xxapi.cn/api/wallpaper")
    console.log("@", res.data.data)
    let obj = { id: nanoid(), src: res.data.data }
    talkList.unshift(obj)
  }
  // 返回数据
  return { talkList, getAPic }
})